<style type="text/css">
.helper {
	border:1px dashed #777;
}
.current-nesting {
	background-color: yellow;
}
</style>
<script type="text/javascript" src="../Public/js/nestedSortables/externals/released-externals/interface-1.2.js"></script>
<script type="text/javascript" src="../Public/js/nestedSortables/compressed/nested_sortable/inestedsortable.js"></script>
<script type="text/javascript">

function delPage(id){
	if(confirm("确认删除？")){
		var url = "{:U('portal/Page/doDelete',array('channelId'=>$channelId))}&id="+id;
		window.location = url;
	}	
}

$(function () { 
	$('#ul_main').NestedSortable(
		{
			accept: 'cla',
			opacity: .8,
			helperclass: 'helper',
			rightToLeft: true,
			nestingPxSpace: 60, 
			currentNestingClass: 'current-nesting',
			onChange: function(serialized) {
				var url = "{:U('portal/Page/changSort',array('channelId'=>$channelId))}&"+serialized[0].hash;
				$.get(url);
			}		
		}
	);		
});
</script>

<div class="tree tree_L">
    <h3 class="tree_tit">频道结构</h3>
    <span class="t_s">{$channelId|getChannelTitle}</span>
    <ul class="tree_tit_C" id="ul_main">        
        <volist name='pageList' id='vo'>
            <li class="cla" id="ele-{$vo.id}">
                <php>if($vo['name']!='首页'){</php>
                <span class="R ml5"><a href="javascript:void(0)" onclick="delPage({$vo.id});return false;">删除</a></span>
                <php>}</php>
                <php>if(getPageType($vo['pageId'])=='list'){</php>
                <span class="R"><a href="{:U('portal/Cms/admin',array('channelId'=>$channelId, 'category'=>$vo[id]))}">列表</a></span>
                <php>}</php>
                <a href="{:U('portal/Page/index',array('channelId'=>$channelId, 'id'=>$vo[pageId]))}">{$vo.name}</a>
            </li>
        </volist>
    </ul>
    <p> <a class="add" href="{:U('portal/Cms/add','channelId='.$channelId)}">增加文章</a><a class="add ml20" href="{:U('portal/Page/index','channelId='.$channelId)}">增加页面</a></p>
</div>
